// 具体产品类
var ConcreteProductA = /** @class */ (function () {
    function ConcreteProductA() {
    }
    ConcreteProductA.prototype.operation = function () {
        return 'Product A';
    };
    return ConcreteProductA;
}());
var ConcreteProductB = /** @class */ (function () {
    function ConcreteProductB() {
    }
    ConcreteProductB.prototype.operation = function () {
        return 'Product B';
    };
    return ConcreteProductB;
}());
// 工厂类
var Factory = /** @class */ (function () {
    function Factory() {
    }
    Factory.createProduct = function (type) {
        switch (type) {
            case 'A':
                return new ConcreteProductA();
            case 'B':
                return new ConcreteProductB();
            default:
                throw new Error('Unknown product type');
        }
    };
    return Factory;
}());
// 使用工厂创建对象
var productA = Factory.createProduct('A');
var productB = Factory.createProduct('B');
console.log(productA.operation());
console.log(productA.operation());
console.log(productA.operation());
console.log(productA.operation());
console.log(productB.operation());
